import { Toast } from "vant";
export default {
  data() {
    return {
        opt: false,
    }
  },
  // 生命周期 - 创建完成（访问当前this实例）
  created() {
      
  },
  // 生命周期 - 挂载完成（访问DOM元素）
  mounted() {
      
  },
  // Vue方法定义
  methods: {
    touchOption(e) {
        let end = {};
        let start = {};
        let diffY = null;
        clearTimeout(this.timer)
        this.timer=null;
        
        start = {
          x: e.touches[0].clientX,
          y: e.touches[0].clientY,
        };
        this.$refs.neiceng.addEventListener("touchmove", (e) => {
          end = {
            x: e.touches[0].clientX,
            y: e.touches[0].clientY,
          };
          diffY = end.y - start.y;
          if (end.y - start.y ) {
            // console.log('向下拖动',diffY)
            this.$refs["add"].style.left = "100%";
            this.$refs["pictures"].style.left = "100%";
            this.$refs["article"].style.left = "100%";
            this.$refs["videos"].style.left = "100%";
            this.$refs["pictures"].style.transform = "scale(1.3) translateX(0)";
          this.$refs["article"].style.transform ="scale(1.3) translate(0)";
          this.$refs["videos"].style.transform = "scale(1.3) translateY(0)";
          this.$refs["pictures"].style.opacity = '0';
          this.$refs["article"].style.opacity ='0';
          this.$refs["videos"].style.opacity = '0';
          this.opt=false
          }
        });
      },
      touchendOption() {
        this.$refs["neiceng"].removeEventListener("touchstart", this.touchOption);
        this.$refs["neiceng"].removeEventListener("touchmove", this.touchOption);
        this.timer=setTimeout(() => {
          if(this.$refs["add"]){
            this.$refs["add"].style.left = "83%";
            this.$refs["pictures"].style.left = "83%";
            this.$refs["article"].style.left = "83%";
            this.$refs["videos"].style.left = "83%";
            this.$refs["add"].style.transform = "scale(1.3) rotate(0)";
          }
            
        }, 800);
      },
      option() {
        this.opt = !this.opt;
        if (this.opt) {
          this.$refs["add"].style.transform = "scale(1.3) rotate(45deg)";
          this.$refs["pictures"].style.transform = "scale(1.1) translateY(-1.433333rem)";
          this.$refs["article"].style.transform ="scale(1.1) translate(-1rem,-.983333rem)";
          this.$refs["videos"].style.transform = "scale(1.1) translate(-1.433333rem,0.1rem)";
          this.$refs["pictures"].style.opacity = '1';
          this.$refs["article"].style.opacity ='1';
          this.$refs["videos"].style.opacity = '1';
        } else {
          this.$refs["add"].style.transform = "scale(1.3) rotate(0)";
          this.$refs["pictures"].style.transform = "scale(1.3) translateX(0)";
          this.$refs["article"].style.transform ="scale(1.3) translate(0)";
          this.$refs["videos"].style.transform = "scale(1.3) translateY(0)";
          this.$refs["pictures"].style.opacity = '0';
          this.$refs["article"].style.opacity ='0';
          this.$refs["videos"].style.opacity = '0';
        }
      },
      picOption(){
        console.log(JSON.parse(localStorage.getItem('vuex')).login.loginuser.type)
        if (!sessionStorage.getItem("token")) {
          this.$router.history.push({
            path: "/login",
            query: {
              path: this.$route.path,
            },
          })
          
        }else{
           this.release=true
        
        this.$nextTick(()=>{
            this.$refs['rele'].$el.style.top=0
        })
        }
       
      },
}
}
